#include "strOpcode.h"

StrOpcode::StrOpcode(){
	this->initOp();
}

void StrOpcode::initOp(){
	int len;
	char mp[][2] = {
		0x4, 1,
		0x5, 2,
		0xB, 1,
		0xC, 0,
		0xD, 0,
		0xE, 0,
		0x10, 1,
		0x11, 0
	};
	string ops[]={
		"textboxColor",
		"clearText",
		"choice",
		"waitForSound",
		"sound",
		"unknownE",
		"appendText",
		"unknown11"
	};
	len = 8;
	op.clear();
	for (int i = 0; i < len; i++)
	{
		op.insert(pair<string,pair<char,char> >(ops[i],pair<char,char>(mp[i][0],mp[i][1])));
	}
	for (int i = 0; i < len; i++)
	{
		rop.insert(pair<char,pair<string,char> >(mp[i][0],pair<string,char>(ops[i],mp[i][1])));
	}
}
bool StrOpcode::getOpCode(string s){
	opit = op.find(s);
	return opit != op.end();
}

bool StrOpcode::getOp(char c1) {
	ropit = rop.find(c1);
	return ropit != rop.end();
}

string StrOpcode::getName() {
	return ropit->second.first;
}

int StrOpcode::getArgc() {
	return ropit->second.second;
}